<?php
/**
 * @package		Joomla.Site
 * @subpackage	com_users
 * @copyright	Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
 * @license		GNU General Public License version 2 or later; see LICENSE.txt
 * @since		1.6
 */

defined('_JEXEC') or die;

JHtml::_('behavior.keepalive');
JHtml::_('behavior.tooltip');
JHtml::_('behavior.formvalidation');
//load user_profile plugin language
$lang = JFactory::getLanguage();
$lang->load( 'plg_user_profile', JPATH_ADMINISTRATOR );
$user1	= JFactory::getUser();
$db =& JFactory::getDBO(); 
$query = "select * from #__users where id=".$user1->id."";
									//echo $query ;die();
$db->setQuery( $query );
$user= $db->loadObject();	
//print_r($user); die();
$country_list = array(
		"Afghanistan",
		"Albania",
		"Algeria",
		"Andorra",
		"Angola",
		"Antigua and Barbuda",
		"Argentina",
		"Armenia",
		"Australia",
		"Austria",
		"Azerbaijan",
		"Bahamas",
		"Bahrain",
		"Bangladesh",
		"Barbados",
		"Belarus",
		"Belgium",
		"Belize",
		"Benin",
		"Bhutan",
		"Bolivia",
		"Bosnia and Herzegovina",
		"Botswana",
		"Brazil",
		"Brunei",
		"Bulgaria",
		"Burkina Faso",
		"Burundi",
		"Cambodia",
		"Cameroon",
		"Canada",
		"Cape Verde",
		"Central African Republic",
		"Chad",
		"Chile",
		"China",
		"Colombi",
		"Comoros",
		"Congo (Brazzaville)",
		"Congo",
		"Costa Rica",
		"Cote d'Ivoire",
		"Croatia",
		"Cuba",
		"Cyprus",
		"Czech Republic",
		"Denmark",
		"Djibouti",
		"Dominica",
		"Dominican Republic",
		"East Timor (Timor Timur)",
		"Ecuador",
		"Egypt",
		"El Salvador",
		"Equatorial Guinea",
		"Eritrea",
		"Estonia",
		"Ethiopia",
		"Fiji",
		"Finland",
		"France",
		"Gabon",
		"Gambia, The",
		"Georgia",
		"Germany",
		"Ghana",
		"Greece",
		"Grenada",
		"Guatemala",
		"Guinea",
		"Guinea-Bissau",
		"Guyana",
		"Haiti",
		"Honduras",
		"Hungary",
		"Iceland",
		"India",
		"Indonesia",
		"Iran",
		"Iraq",
		"Ireland",
		"Israel",
		"Italy",
		"Jamaica",
		"Japan",
		"Jordan",
		"Kazakhstan",
		"Kenya",
		"Kiribati",
		"Korea, North",
		"Korea, South",
		"Kuwait",
		"Kyrgyzstan",
		"Laos",
		"Latvia",
		"Lebanon",
		"Lesotho",
		"Liberia",
		"Libya",
		"Liechtenstein",
		"Lithuania",
		"Luxembourg",
		"Macedonia",
		"Madagascar",
		"Malawi",
		"Malaysia",
		"Maldives",
		"Mali",
		"Malta",
		"Marshall Islands",
		"Mauritania",
		"Mauritius",
		"Mexico",
		"Micronesia",
		"Moldova",
		"Monaco",
		"Mongolia",
		"Morocco",
		"Mozambique",
		"Myanmar",
		"Namibia",
		"Nauru",
		"Nepal",
		"Netherlands",
		"New Zealand",
		"Nicaragua",
		"Niger",
		"Nigeria",
		"Norway",
		"Oman",
		"Pakistan",
		"Palau",
		"Panama",
		"Papua New Guinea",
		"Paraguay",
		"Peru",
		"Philippines",
		"Poland",
		"Portugal",
		"Qatar",
		"Romania",
		"Russia",
		"Rwanda",
		"Saint Kitts and Nevis",
		"Saint Lucia",
		"Saint Vincent",
		"Samoa",
		"San Marino",
		"Sao Tome and Principe",
		"Saudi Arabia",
		"Senegal",
		"Serbia and Montenegro",
		"Seychelles",
		"Sierra Leone",
		"Singapore",
		"Slovakia",
		"Slovenia",
		"Solomon Islands",
		"Somalia",
		"South Africa",
		"Spain",
		"Sri Lanka",
		"Sudan",
		"Suriname",
		"Swaziland",
		"Sweden",
		"Switzerland",
		"Syria",
		"Taiwan",
		"Tajikistan",
		"Tanzania",
		"Thailand",
		"Togo",
		"Tonga",
		"Trinidad and Tobago",
		"Tunisia",
		"Turkey",
		"Turkmenistan",
		"Tuvalu",
		"Uganda",
		"Ukraine",
		"United Arab Emirates",
		"United Kingdom",
		"United States",
		"Uruguay",
		"Uzbekistan",
		"Vanuatu",
		"Vatican City",
		"Venezuela",
		"Vietnam",
		"Yemen",
		"Zambia",
		"Zimbabwe"
	);

?>
<h2 class="heading-icon ig-user">MY ACCOUNT</h2>
			<?php 
				$article = JUtility::getArticle(129);
				echo $article->introtext;
			?>
                    <div class="tpl-form gradient-1 clearfix">
                        <form id="member-profile" action="<?php echo JRoute::_('index.php?option=com_users&task=profile.save'); ?>" method="post" class="form-validate" enctype="multipart/form-data">

                             <div class="input-block ip-col-2">
                                <label for="">Firstname *</label>
                                <input type="text" class="f-input i-toggle required" value="<?php echo $user->first_name?>" name="jform[first_name]" id="jform_first_name">
                            </div>
                            <div class="input-block ip-col-2 col-last">
                                <label for="">Lastname *</label>
                                <input type="text" class="f-input i-toggle required" value="<?php echo $user->last_name?>"  name="jform[last_name]" id="jform_last_name">
                            </div>
                            <div class="input-block ip-col-2">
                                <label for="">Title *</label>
                                <input type="text" class="f-input i-toggle required" value="<?php echo $user->title?>"  name="jform[title]" id="jform_title">
                            </div>
                            <div class="input-block ip-col-2 col-last">
                                <label for="">Company *</label>
                                <input type="text" class="f-input i-toggle required" value="<?php echo $user->company?>"  name="jform[company]" id="jform_company">
                            </div>
                            <div class="input-block ip-col-2">
                                <label for="">E-mail *</label>
                                <input type="text" readonly="true" value="<?php echo $user->email?>" name="jform[email1]" id="jform_email1">
                                 <input style="display:none;" type="text" value="<?php echo $user->email?>" name="jform[username]" id="jform_username">
                                 <input style="display:none;" type="text" value="<?php echo $user->first_name . $user->last_name ?>" name="jform[name]" id="jform_name">
                           
                            </div>
                            <div class="input-block ip-col-2 col-last">
                                <label for="">Phone no. *</label>
                                <input type="text" class="f-input i-toggle required" value="<?php echo $user->phone?>" name="jform[phone]" id="jform_phone">
                            </div>
                            <div class="input-block ip-col-2">
                                <label for="">Country *</label>
                                <select class="f-select" name="jform[country]" id="jform_country">
                                    <?php for($i=0;$i<count($country_list);$i++){?>
                                    <option <?php if($country_list[$i]==$user->country) echo "selected";?>><?php echo $country_list[$i]?></option>
                                    <?php }?>
                                </select>
                            </div>
                            <div class="input-block ip-col-2 col-last">
                                <label for="">State</label>
                                <input type="text" class="f-input i-toggle" value="<?php echo $user->status?>"  name="jform[status]" id="jform_status">
                            </div>
                            
                            <div class="input-block ip-col-2">
                                <label for="">Password *</label>
                                <input type="password" class="f-input i-toggle required"  name="jform[password1]" id="jform_password1" >
                            </div>
                            <div class="input-block ip-col-2 col-last">
                                <label for="">Confirm Password *</label>
                                <input type="password" class="f-input i-toggle required"  name="jform[password2]" id="jform_password2">
                            </div>
                            
                            <div class="clr"></div>
                            <div class="input-block">
                                <label for="">Your message</label>
                                <textarea class="i-toggle" name="jform[message]" id="jform_message" ><?php echo $user->message?></textarea>
                            </div>
                            <div class="clr"></div>
                            <div class="form-submit clearfix">
                                <a href="#" class="btnSave" onclick="jQuery('#member-profile').submit();">Login</a>
                            </div>
                       

						     <input type="hidden" name="option" value="com_users" />
			            <input type="hidden" name="task" value="profile.save" />
						<input type="hidden" name="layout" value="edit" />
						<input type="hidden" name="template" value="login" />
			            <?php echo JHtml::_('form.token'); ?>
                        </form>
                    </div>
                    <p id="p-field">* All fields are mandatory</p>




<?php return; ?>
<div class="profile-edit<?php echo $this->pageclass_sfx?>">
<?php if ($this->params->get('show_page_heading')) : ?>
	<h1><?php echo $this->escape($this->params->get('page_heading')); ?></h1>
<?php endif; ?>

<form id="member-profile" action="<?php echo JRoute::_('index.php?option=com_users&task=profile.save'); ?>" method="post" class="form-validate" enctype="multipart/form-data">
<?php foreach ($this->form->getFieldsets() as $group => $fieldset):// Iterate through the form fieldsets and display each one.?>
	<?php $fields = $this->form->getFieldset($group);?>
	<?php if (count($fields)):?>
	<fieldset>
		<?php if (isset($fieldset->label)):// If the fieldset has a label set, display it as the legend.?>
		<legend><?php echo JText::_($fieldset->label); ?></legend>
		<?php endif;?>
		<dl>
		<?php foreach ($fields as $field):// Iterate through the fields in the set and display them.?>
			<?php if ($field->hidden):// If the field is hidden, just display the input.?>
				<?php echo $field->input;?>
			<?php else:?>
				<dt>
					<?php echo $field->label; ?>
					<?php if (!$field->required && $field->type!='Spacer' && $field->name!='jform[username]'): ?>
						<span class="optional"><?php echo JText::_('COM_USERS_OPTIONAL'); ?></span>
					<?php endif; ?>
				</dt>
				<dd><?php echo $field->input; ?></dd>
			<?php endif;?>
		<?php endforeach;?>
		</dl>
	</fieldset>
	<?php endif;?>
<?php endforeach;?>

		<div>
			<button type="submit" class="validate"><span><?php echo JText::_('JSUBMIT'); ?></span></button>
			<?php echo JText::_('COM_USERS_OR'); ?>
			<a href="<?php echo JRoute::_(''); ?>" title="<?php echo JText::_('JCANCEL'); ?>"><?php echo JText::_('JCANCEL'); ?></a>

			<input type="hidden" name="option" value="com_users" />
			<input type="hidden" name="task" value="profile.save" />
			<?php echo JHtml::_('form.token'); ?>
		</div>
	</form>
</div>
